package com.skyline.jfs.namespace.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.skyline.jfs.namespace.model.JFSFile;

//import com.skyline.jfs.namespace.model.JFSDirectory;

public class JFSFileMapper implements RowMapper<JFSFile> {
	
	private static JFSFileMapper mapper = new JFSFileMapper();

	public static JFSFileMapper getMapper() {
		return mapper;
	}

	@Override
	public JFSFile mapRow(ResultSet rs, int rowNum) throws SQLException {
		//if(rs.next()==false) return null;
		JFSFile f=new JFSFile();
		f.setCreatedTime(rs.getTimestamp("createdTime"));
		f.setExist(rs.getBoolean("exist"));
		f.setId(rs.getLong("id"));
		f.setName(rs.getString("name"));
		f.setParent(rs.getLong("parent"));
		f.setPath(rs.getString("path"));
		f.setPermission(rs.getInt("permission"));
		f.setReplicNum(rs.getInt("replicNum"));
		f.setSize(rs.getLong("size"));
		return f;
	}
}
